package com.dyrj.ysk.util;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * @author 吴侠志  2019/10/17
 * @version 1.0
 */
public class ExceptionUtil {
    /**
     * 获取异常堆栈信息
     * @param throwable
     * @return
     */
    public static String getStackTrace(Throwable throwable)
    {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        try {
            throwable.printStackTrace(pw);
            return sw.toString();
        } finally {
            pw.close();
        }
    }

}
